function showDiv(){
document.getElementById('popDiv').style.display='block';
document.getElementById('bg').style.display='block';
}
function closeDiv(){
document.getElementById('popDiv').style.display='none';
document.getElementById('bg').style.display='none';
}

function showDiv1(){
document.getElementById('popDiv1').style.display='block';
document.getElementById('bg').style.display='block';
}
function closeDiv1(){
document.getElementById('popDiv1').style.display='none';
document.getElementById('bg').style.display='none';
}
function showDiv2(){
document.getElementById('popDiv2').style.display='block';
document.getElementById('bg').style.display='block';
}
function closeDiv2(){
document.getElementById('popDiv2').style.display='none';
document.getElementById('bg').style.display='none';
}
function showDiv3(){
	document.getElementById('popDiv3').style.display='block';
	document.getElementById('bg').style.display='block';
	}
function closeDiv3(){
	document.getElementById('popDiv3').style.display='none';
	document.getElementById('bg').style.display='none';
	}
function showDivDelete(id){
	document.getElementById('del_item_id').value = id;
	document.getElementById('popDivDel').style.display='block';
	document.getElementById('bg').style.display='block';
	}
function closeDivDelete(){
	document.getElementById('popDivDel').style.display='none';
	document.getElementById('bg').style.display='none';
	}

function showDivDelete2(){
	document.getElementById('popDivDel2').style.display='block';
	document.getElementById('bg').style.display='block';
	}
function closeDivDelete2(){
	document.getElementById('popDivDel2').style.display='none';
	document.getElementById('bg').style.display='none';
	}


function showDivEdit(id){
	document.getElementById('edit_item_id').value = id;
	document.getElementById('popDivEdit').style.display='block';
	document.getElementById('bg').style.display='block';
	}
function closeDivEdit(){
	document.getElementById('popDivEdit').style.display='none';
	document.getElementById('bg').style.display='none';
	}

function showDivDetail(id){
	var div = "popDivDetail"+id;
	document.getElementById(div).style.display='block';
	document.getElementById('bg').style.display='block';
}
function closeDivDetail(id){
	var div = "popDivDetail"+id;
	document.getElementById(div).style.display='none';
	document.getElementById('bg').style.display='none';
}

function submitForm(content,form){
	
	if(document.getElementById(content).value!=""&&document.getElementById(content).value!=null){
	document.getElementById(form).submit();}
	else{
		alert("说点什么再提交吧~");
	}
}


function logoutSubmit(){
    var xmlHttp;
	try
	 {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
			// Internet Explorer
		 try
			  {
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			  }
		 catch (e)
			  {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
	 }
	 if(!xmlHttp)
	 {
		alert("无法创建对象!");
	 }
	var url="http://herald.seu.edu.cn/i/login.php?command=logout";
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	document.getElementById('logoutURL').value =this.location.href;
	document.getElementById('logout').submit();
}

function attention(league){
    var xmlHttp;
	try
	 {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
			// Internet Explorer
		 try
			  {
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			  }
		 catch (e)
			  {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
	 }
	 if(!xmlHttp)
	 {
		alert("无法创建对象!");
	 }
	var url="./AttentionAdd?league="+league;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	xmlHttp.onreadystatechange =function(){
	if (xmlHttp.readyState==4 && xmlHttp.status==200){
		var getStr=xmlHttp.responseText;
		if(getStr!="success"){
			alert("网络出现状况，添加失败。");
		}
		if(getStr=="success"){
			
			document.getElementById("att").style.display="none";
			document.getElementById("cancleAtt").style.display="block";
		}
	}
	}
}

function cancleAttention(league){
    var xmlHttp;
	try
	 {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
			// Internet Explorer
		 try
			  {
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			  }
		 catch (e)
			  {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
	 }
	 if(!xmlHttp)
	 {
		alert("无法创建对象!");
	 }
	var url="./AttentionDelete?league="+league;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	xmlHttp.onreadystatechange =function(){
		
	if (xmlHttp.readyState==4 && xmlHttp.status==200){
		var getStr=xmlHttp.responseText;
		
		if(getStr!="success"){
			alert("网络出现状况，添加失败。");
		}
		if(getStr=="success"){
			
			
			document.getElementById("cancleAtt").style.display="none";
			document.getElementById("att").style.display="block";
		}
	}
	}
}

function attentionPost(url,form){
	document.getElementById(url).value =this.location.href;
	document.getElementById(form).submit();
}

function isNum(para){
	var parameter = document.getElementById(para).value;
	if((!isNaN(parameter))&&parameter>0){
		return true;
	}else{
		return false;
	}
}

function GetRequest() {
   var url = location.search; //获取url中"?"符后的字串
   var theRequest = new Object();
   if (url.indexOf("?") != -1) {
      var str = url.substr(1);
      strs = str.split("&");
      for(var i = 0; i < strs.length; i ++) {
         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
      }
   }
   return theRequest;
}

function editH(right,left){
	rightH=document.getElementById(right).offsetHeight;
	if(rightH<600){
		document.getElementById(left).style.height=600+"px";}
		else{
			document.getElementById(left).style.height=rightH+"px";
		}
	}

var count=1;
function addUploadButton(){    
    // 按ID找到FOrm
    var uploadFormDiv=document.getElementById("uploadForm");    
    
    // 创建P元素
    var pNode=document.createElement("p");
    
    // 累加Count以观察次数
    count=count+1; 
    pNode.innerHTML="图片名称：<input type=text name=picName ><input type=file name=fileforload >";
    
    // 将P元素添加到body中
    uploadFormDiv.appendChild(pNode);
}